<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


<h2>${pageTitle}</h2>

<c:choose>
    <c:when test="${aantalForums != 0 || aantalThreads != 0}">
        <!-- Wanneer er forums opgeslagen zijn, worden ze hier getoond -->
        <table class="zebra">
            <tr>
                <th>
                    <strong>Forum topics</strong>
                </th>
                <th>
                    <strong>Description</strong>
                </th>
                <th>
                    <strong>Last post</strong>
                </th>
                <th>
                </th>
            </tr>
            <c:forEach var="tempForum" items="${forumsUitSessie}">
                <!-- Forum topics -->
                <tr>
                    <td width="120px;">
                        <a href="${url}forum/topic_view?topic_id=${tempForum.forumtopicid}">${tempForum.forumTopicName}</a>
                    </td>
                    <td>
                        ${tempForum.forumtopicbody}
                    </td>
                    <td>
                        <!-- Last activity here! :) -->
                    </td>
                    <td>
                        <a class="icon view" href="${url}forum/topic_view?topic_id=${tempForum.forumtopicid}">${tempForum.forumTopicName}</a>
                    </td>
                </tr>
            </c:forEach>

            <tr height="10px;"></tr>
        </table>
        <table class="zebra">

            <!-- Forum threads ----------------------------------------------------->
            <tr>
                <th>
                    <strong>Forum threads</strong>
                </th>
                <th>
                    <strong>Description</strong>
                </th>
                <th>
                    <strong>Last post</strong>
                </th>
                <th>
                    <strong> </strong>
                </th>
            </tr>
            <c:forEach var="tempThread" items="${threadsUitSessie}">
                <tr>
                    <td width="120px;">
                        <a href="${url}forum/thread_view?thread_id=${tempThread.forumThreadId}">${tempThread.forumThreadName}</a>
                    </td>
                    <td>
                        ${tempThread.forumThreadBody}
                    </td>
                    <td>
                        <!-- Last activity here! :) -->
                    </td>
                    <td>
                        <a class="icon view" href="${url}forum/thread_view?thread_id=${tempThread.forumThreadId}">${tempThread.forumThreadName}</a>
                    </td>
                </tr>
            </c:forEach>
            </table>
    </c:when>
    <c:otherwise>
        <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
        There are no forums or threads found.
    </c:otherwise>
</c:choose>

</br>
<p>
    <a class="button" href="${url}forum/topic_add">Start new topic</a>
</p>
<p>
    <a class="button" href="${url}forum/thread_add">Start new thread</a>
</p>
<p>
    <a class="button" href="${url}index">Go back to the index</a>
</p>